<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>离线访问 - 日本旅行实用英语指南</title>
    <style>
        :root {
            --primary-color: #e83a52;
            --secondary-color: #2c3e50;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
            background-color: #f8f9fa;
            color: #333;
            line-height: 1.6;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            padding: 20px;
        }
        
        .container {
            max-width: 600px;
            text-align: center;
            background-color: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        
        .icon {
            font-size: 60px;
            margin-bottom: 20px;
            color: var(--primary-color);
        }
        
        h1 {
            color: var(--secondary-color);
            margin-bottom: 20px;
            font-size: 2rem;
        }
        
        p {
            margin-bottom: 25px;
            font-size: 1.1rem;
        }
        
        .btn {
            display: inline-block;
            padding: 12px 25px;
            background-color: var(--primary-color);
            color: white;
            text-decoration: none;
            border-radius: 6px;
            font-weight: 600;
            transition: background-color 0.3s;
        }
        
        .btn:hover {
            background-color: #c0392b;
        }
        
        .cached-resources {
            margin-top: 30px;
            text-align: left;
            border-top: 1px solid #eee;
            padding-top: 20px;
        }
        
        .cached-resources h2 {
            font-size: 1.3rem;
            margin-bottom: 15px;
            color: var(--secondary-color);
        }
        
        .cached-resources ul {
            list-style: none;
        }
        
        .cached-resources li {
            margin-bottom: 8px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="icon">📶</div>
        <h1>您处于离线状态</h1>
        <p>无法连接到网络。您正在查看的内容未缓存，需要网络连接才能访问。</p>
        <p>但别担心！您仍可以访问已缓存的部分内容。</p>
        <a href="/" class="btn">返回主页</a>
        
        <div class="cached-resources">
            <h2>可离线访问的资源</h2>
            <ul>
                <li>✅ 主页及核心英语表达</li>
                <li>✅ 基本场景分类内容</li>
                <li>✅ 常用英语短语</li>
                <li>❌ 部分音频资源（需网络连接）</li>
                <li>❌ 实时更新的内容</li>
            </ul>
        </div>
    </div>
    
    <script>
        // 检测网络状态
        function updateOnlineStatus() {
            const statusElement = document.querySelector('.icon');
            if (navigator.onLine) {
                statusElement.textContent = '🌐';
                setTimeout(() => {
                    window.location.href = '/';
                }, 2000);
            } else {
                statusElement.textContent = '📶';
            }
        }

        window.addEventListener('online', updateOnlineStatus);
        window.addEventListener('offline', updateOnlineStatus);
        
        // 初始检查
        updateOnlineStatus();
    </script>
</body>
</html>